﻿<%@page import="cn.jdy.common.constant.GlobalConstant"%>
<%@ page language="java" contentType="text/html; charset=utf-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="jdy" uri="http://www.qwe.com.cn/tags" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>康养旅居网</title>
          <jsp:include page="../common/common.jsp"/>
                <link rel="stylesheet" href="${path}/css/sign.css">
</head>
<body>
    <div class="signtitle">
        <h3></h3>
    </div>

    <div class="box setting">
              	<form id="frm_login" method="post" action="${path}/member/selfsave">

        <ul>
            <li>
                开户行：<span>
               <select name="smh"  id="smh">
                 <option value="">请选择</option>
                    <option value="建行"  <c:if test="${'建行'== mc.smh }">selected="selected" </c:if>>建行</option>
                    <option value="工行" <c:if test="${'工行'== mc.smh }">selected="selected" </c:if>>工行</option>
                    <option value="中国银行" <c:if test="${'中国银行'== mc.smh }">selected="selected" </c:if>>中国银行</option>
                    <option value="农行" <c:if test="${'农行'== mc.smh }">selected="selected" </c:if>>农行</option>
               </select>
            </span>
                
            </li>
            <li>
                姓名：<input type="text" name="cardname" id="cardname"   value="${mc.cardname}">
            </li>
            <li>
                卡号：<input type="text" name="cardnumber" id="cardnumber"  value="${mc.cardnumber}" >
            </li>
              <li>
               提现密码：<input type="password" name="txpassd" id="txpassd"  value="${member.txpassd}"  placeholder="密码"> 
            </li>
                <li>
                验证码：<input type="text" name="authcode" id="dxya" placeholder="请输入验证码"><input class="getcode" type="button"  onclick="endsms(this)" value="获取验证码">
            </li>
        </ul>
                     <input type="hidden" name="id" id="id" value="${mc.id} ">
                        <input type="hidden" name="membername" id="membername" value="${member.userName}">
                        <input type="hidden" name="memberid" id="memberid" value="${member.id}">
                        <input type="hidden" name="mobile" id="mobile" value="${member.mobile}">
        
        
        <p class="forget "><!--  <a href="">忘记登录密码?</a>--></p>
        <div class="clearfloat"></div>        </form>
        <button class="signbutton loginout"  onclick="svare()">保存</button>
    
    </div>
    <script src="${path}/js/jquery-3.2.1.min.js"></script>
</body>
<script>

							function checkklieb(){
								
								var value=$("#smh").find("option:selected").val();
								
								 if(value=='' || value == null){
										layer.open({ content:"请选开户行",skin: 'msg' ,time: 2 });//2秒后自动关闭
									 return false;
								 }
								 return true;
								}
							function checkka(){
								var account = $("#cardnumber").val();
								if (account =="" || account.length < 15 || account.length  > 20) {
								layer.open({ content:"银行卡号数必须在16到19之间",skin: 'msg' ,time: 2 });//2秒后自动关闭

								return false;
								}
								var num = /^\d*$/;  //全数字
								if (!num.exec(account)) {
								
								layer.open({ content:"银行卡号必须全为数字",skin: 'msg' ,time: 2 });//2秒后自动关闭

								return false;
								}
								return true;
							}
								function checkname(){
									
									var value=$("#cardname").val()
									 if(value=='' || value == null){
											layer.open({ content:"请输入姓名",skin: 'msg' ,time: 2 });//2秒后自动关闭
										 return false;
									 }
									 return true;
									}
								
							function checkpass(){
									
									var value=$("#txpassd").val()
									 if(value=='' || value == null){
											layer.open({ content:"请输入提现密码",skin: 'msg' ,time: 2 });//2秒后自动关闭
										 return false;
									 }
									 return true;
									}
								
								var countdown=60;
								function hqyzm(val){
									if (countdown == 0) {
										val.removeAttribute("disabled");
										val.value="获取验证码";
										countdown = 60;
								
									} else {
							
										val.setAttribute("disabled", true);
										val.value="重新发送(" + countdown + ")";
										countdown--;
										setTimeout(function() {
											hqyzm(val)
									},1000)
									}
									
								
								}
								
								function valYzm(){
									 var value = $("#dxya").val();
									 if(value=='' || value == null){
											layer.open({ content:"请输入验证码",skin: 'msg' ,time: 2 });//2秒后自动关闭
										 return false;
									 }else{
											 return true;	
									 
									 }
						
								}
								
								function endsms(val){
								
										 $.ajax({
									           url: _path + "/register/fasongyanzm?ipone="+$("#mobile").val(),
									           type: "get",
									           async: false,
									           dataType: 'json',
									           success: function (data) {
									        	   if(data.status==0){
														layer.open({ content:"该手机号已被注册",skin: 'msg' ,time: 2 });//2秒后自动关闭
						
									        	   }else{
											           	if (data.yzm == "0") {
											    			layer.open({ content:"发送失败",skin: 'msg' ,time: 2 });//2秒后自动关闭
											           	}else {
											           	//	$("#yzmzz").val(data.yzm);
											           	}
									        	   }
									           }
									     });
											hqyzm(val);
								
								
						
							}
								
					function svare(){
						if(checkklieb()&&checkname()&&checkka()&&valYzm()&&checkpass()){
									   $.ajax({
								            //几个参数需要注意一下
								                type: "POST",//方法类型
								                dataType: "json",//预期服务器返回的数据类型
								                url: "${path}/memberCard/forSaveCard" ,//url
								                data: $('#frm_login').serialize(),
								                success: function (result) {
								                    if (result.msg == 200) {
														layer.open({ content:"保存成功" ,skin: 'msg' ,time: 2 });//2秒后自动关闭
										
								                    }else{
														layer.open({ content: "请填写正确信息",skin: 'msg' ,time: 2 });//2秒后自动关闭

								                    }
								                    ;
								                },
								                error : function() {
								                    alert("异常！");
								                }
								            });
						}
					}
					
				 
</script>
</html>